﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using App.Data;
using System.Data;

public partial class Pages_Admin_JointVentureList : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        BindPageInfo();
        if (!IsPostBack)
        {
            //BindJointVentureList(1);
        }
    }
    protected void BindPageInfo()
    {
        Page.Title = WebUtil.GetPageTitle(h4Heding.InnerHtml);
    }

    protected void BindJointVentureList(int pageNumber)
    {
        int totalRecord = 0;
        UtilityDAO dao = new UtilityDAO();
        App.Data.DbParameter[] parameters = new[] { new App.Data.DbParameter("@VentureType", rdbLandOwner.Checked ? 1 : 2) };
        DataSet ds = dao.GetPagedData(AppSQL.GET_JOINT_VENTURE_LIST_BY_TYPE, parameters, pageNumber, ConfigReader.NewsLetterListSize, out totalRecord);

        ucJointVentureList.DataSource = ds.Tables[0];
        ucJointVentureList.EditLink = AppConstants.Pages.JOINT_VENTURE_DETAILS + "?" + AppConstants.QueryString.ID + "={0}";
        ucJointVentureList.EditLinkText = "Details";
        ucJointVentureList.DataBind();

        ///Bind Pager
        ucJointVentureListPager.TotalRecord = totalRecord;
        ucJointVentureListPager.PageNo = pageNumber;
        ucJointVentureListPager.PageSize = ConfigReader.NewsLetterListSize;
        ucJointVentureListPager.TotalRecordMessage = "Total {0} Joint Venture Request(s) Found.";
        ucJointVentureListPager.DataBind();
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        BindJointVentureList(1);
    }
    protected void ucJointVentureListPager_PageIndexChanged(object sender, PagerEventArgs e)
    {
        BindJointVentureList(e.PageIndex);
    }
}